package com.cxs.interceptor;

import javax.servlet.http.HttpSession;
import javax.servlet.http.HttpSessionEvent;
import javax.servlet.http.HttpSessionListener;

import com.cxs.model.sys.Sys_User;
import com.cxs.util.KEYUtil;

public class SessionListener implements HttpSessionListener {
	public void sessionDestroyed(HttpSessionEvent sessionEvent) {
		HttpSession session = sessionEvent.getSession();
		if(session != null){
			Sys_User login = (Sys_User)session.getAttribute(KEYUtil.KEY_USER);
			if(login != null){
				SessionHandler.delUserFromSession(login.getId().toString());
			}
		}
	}

	@Override
	public void sessionCreated(HttpSessionEvent se) {
	}
}
